{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit" ng-app="hd" ng-controller="ctrl">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>{$title}</legend>
    </fieldset>
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">问题标题</label>
            <div class="layui-input-4">
                <input type="text" name="ask_title" placeholder="输入问题标题" class="layui-input" value="{$info.ask_title}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">选项</label>
            <div class="layui-input-4">
                <input type="text" name="ask_content" value="{$info.ask_content}" placeholder="输入选项用分号分隔" class="layui-input">（选项用分号分隔，如 中国;俄罗斯;美国）
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结果</label>
            <div class="layui-input-4">
                <input type="text" name="ask_result" value="{$info.ask_result}" placeholder="输入结果" class="layui-input">（填写0代表答案是：中国;1代表答案是：俄罗斯;2代表答案是：美国）
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">积分</label>
            <div class="layui-input-4">
                <input type="text" name="ask_point"  value="{$info.ask_point}" placeholder="积分" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="hidden" name="ask_id"  value="{$info.ask_id}" class="layui-input">
                <input type="hidden" name="match_id"  value="{$match_id}" class="layui-input">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
                <a href="{:url('matchask')}?match_id={$info.match_id}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
            </div>
        </div>
    </form>
</div>
{include file="common/foot"/}
<script src="__STATIC__/common/js/angular.min.js"></script>
<script>
    var m = angular.module('hd', []);
    layui.use(['form', 'upload', 'element', 'layer', 'laydate'], function () {
        var form = layui.form, upload = layui.upload, laydate = layui.laydate, $ = layui.jquery;
    form.on('submit(submit)', function (data) {
        loading = layer.load(1, {shade: [0.1, '#fff']});
        var fields = $(data.form).serialize();
        $.ajax({
            url: "",
            data: fields,
            type: 'post',
            dataType: 'json',
            success: function (res) {

                if (res.code > 0) {
                    layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                        location.href = res.url;
                    });
                } else {
                    layer.msg(res.msg, {icon: 2, time: 1000});
                }
            },
            error: function () {

            },
            complete: function () {
                layer.close(loading);
            },
        });
    });
    });
</script>